package com.authstr.auth.shiro.freemark;

import com.authstr.auth.shiro.ShiroUtil;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;

import java.util.List;

public class ShiroFuncHasRole implements TemplateMethodModelEx {

    @Override
    public Object exec(List args) throws TemplateModelException {
        if (args.isEmpty()) {
            return false;
        }
        String value=args.get(0).toString();
        return ShiroUtil.hasRole(value);
    }

}
